using System;
using System.Collections.Generic;
using System.Text;
using ECommerce.DAL;
using System.Data.SqlClient;
using System.Data;

namespace Entity
{
    [System.ComponentModel.DataObject]
    public class TblCMSExtended : TblCMS
    {
        public static CustomCollection<TblCMS> GetCMSByCmsType(string CmsType)
        {
            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@CmsType", SqlDbType.NVarChar, 50, ParameterDirection.Input, CmsType);

            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBL_CMS_GET_CMS_BY_CMSTYPE);
            GenerateCollectionFromReader reader = new GenerateCollectionFromReader(GenerateTblCMSCollectionFromReader);
            CustomCollection<TblCMS> objCollection = ((CustomCollection<TblCMS>)ExecuteReaderCmd(sqlCmd, reader));
            return objCollection;
        }

        public static CustomCollection<TblCMS> GetCMSByCmsID(int cmsID)
        {
            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@CmsID", SqlDbType.Int, 4, ParameterDirection.Input, cmsID);

            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBL_CMS_GET_CMS_BY_CMSID);
            GenerateCollectionFromReader reader = new GenerateCollectionFromReader(GenerateTblCMSCollectionFromReader);
            CustomCollection<TblCMS> objCollection = ((CustomCollection<TblCMS>)ExecuteReaderCmd(sqlCmd, reader));
            return objCollection;
        }

        private const string SP_TBL_CMS_GET_CMS_BY_CMSTYPE = "sp_TblCMS_Get_CMS_By_CmsType";
        private const string SP_TBL_CMS_GET_CMS_BY_CMSID = "sp_TblCMS_Get_CMS_By_CmsID";
    }
}
